﻿YUI({ lang: 'es' }).use('node',
  'aui-datepicker',
  function (Y) {
      Y.one('#calen').set('value', new Date().toLocaleDateString());

      var datepicker = new Y.DatePicker(
        {
            trigger: '.calendar',
            mask: '%d/%m/%Y',
            popover: {
                toolbars: {
                    header: [[
                      {
                          icon: 'icon-trash',
                          label: 'Borrar',
                          on: {
                              click: function () {
                                  datepicker.clearSelection();
                              }
                          }
                      },
                      {
                          icon: 'icon-globe',
                          label: 'Fecha de Hoy',
                          on: {
                              click: function () {
                                  //datepicker.clearSelection();
                                  datepicker.selectDates(new Date().toLocaleDateString());
                              }
                          }
                      }
                    ]]
                },
                zIndex: 1
            }
        }
      );
  }
);